<script setup>
import { inject } from 'vue'

// 2.需要用数据的后代组件 inject一下
// inject(数据名)
const money = inject('money1')
const changeMoney = inject('changeMoney')
</script>

<template>
  <div>Sun组件---{{ money }}</div>
  <button @click="changeMoney(10)">花钱</button>
</template>
